package net.ufrog.common.data;

import net.ufrog.common.app.App;

/**
 * @author ultrafrog, ufrog.net@gmail.com
 * @version 0.1, 2017-01-29
 * @since 0.1
 */
public class DataConfig {

    private static final String KEY_DB_PREFIX       = "db.prefix";
    private static final String KEY_DB_TEMPLATE     = "db.template";
    private static final String KEY_PAGE_SIZE       = "sys_page_size";

    private static final String DEFAULT_PREFIX      = "";
    private static final String DEFAULT_TEMPLATE    = "/ql-template/";
    private static final String DEFAULT_PAGE_SIZE   = "20";

    /** 构造函数 */
    private DataConfig() {}

    /**
     * 读取库表前缀
     *
     * @return 库表前缀
     */
    public static String getDBPrefix() {
        return App.config(KEY_DB_PREFIX, DEFAULT_PREFIX);
    }

    /**
     * 读取脚本模板地址
     *
     * @return 脚本模板地址
     */
    public static String getDBTemplate() {
        return App.config(KEY_DB_TEMPLATE, DEFAULT_TEMPLATE);
    }

    /**
     * 读取分页大小
     *
     * @return 分页大小
     */
    public static Integer getPageSize() {
        return Integer.valueOf(App.config(KEY_PAGE_SIZE, DEFAULT_PAGE_SIZE));
    }
}
